
// //////////////////////////////////////////////////////////
// Hotkeys
// //////////////////////////////////////////////////////////
window.addEventListener("keypress",BCAkeyboardAction,true);

function BCAkeyboardAction (e) {
    if(window.name == '' || e.ctrlKey) return;
    if (e.target.nodeName.toUpperCase() == 'INPUT' || e.target.nodeName.toUpperCase() == 'TEXTAREA') return;
    var keynum = e.which;
    var key = String.fromCharCode(keynum).toLowerCase();
    
    if (key == "r") BCArepairOrExit ();
}

function BCArepairOrExit () {
    var btns = document.getElementsByName ("action");
    for (var i=0; i<btns.length; i++) {
        var btn = btns[i];
        if (btn.value == "Repair all" && btn.getAttribute ("class") != "disabled") {
            btn.form.submit ();
            return;
        }
    }
    window.location = "main.php";
}